package com.quanquan.store.repository.marketActivity.scratchCard;

import com.quanquan.store.entity.marketActivity.scratchCard.ScratchCardRecord;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @ClassName ScratchCardRecordRepository
 * @Description
 * @Author Owen
 * @Date 2019/8/28 0028 上午 11:07
 * @Version V1.0
 **/
public interface ScratchCardRecordRepository extends JpaRepository<ScratchCardRecord,Long>, JpaSpecificationExecutor<ScratchCardRecord> {

    @Query(value = "select * from oo_scratch_card_record where scratch_card_id = ?1 and user_id = ?2 and gift_type > 0 order by create_time desc",nativeQuery = true)
    List<ScratchCardRecord> findUserRecordList(Long scratchCardId,String userId);
}
